package com.qb.controller;

import com.qb.entity.DialogResult;
import com.qb.service.EvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("evaluate")
public class EvaluateController {

    @Autowired
    private EvaluateService evaluateService;

    //    查询所有评论
    @RequestMapping("findAll")
    @ResponseBody
    public List findAll() {

        List list = evaluateService.findAll();

        return list;
    }

    //删除    deleteByEid
    @RequestMapping("deleteByEid")
    @ResponseBody
    public DialogResult deleteByEid(Integer eid) {
        DialogResult result = new DialogResult();
        boolean flag = evaluateService.deleteByEid(eid);
        if (flag == true) {
            result.setMsg("删除成功！");
        } else {
            result.setError("删除失败!");
        }
        return result;
    }

    //模糊查询 findByEvaConent
    @RequestMapping("findByEvaConent")
    @ResponseBody
    public List findByEvaConent(String evaconent) {
        List list = evaluateService.findByEvaConent(evaconent);
        return list;
    }
}
